<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<%@ taglib prefix="his_fns" uri="/WEB-INF/tlds/his_fns.tld" %>

<script>
    var ctx = '${ctx}';
    perscriptionAuto();
    function perscriptionAuto(){
        var mainPerscriptionHeight=$("#mainPerscription").height();
        var mainPerscriptionHeight=$("#mainPerscription").height();
        var rigthDoctorCenterDivHeight=$("#rigthDoctorCenterDiv").height();
        $("#prescWesternItemDiv").height(rigthDoctorCenterDivHeight-mainPerscriptionHeight-20);
        $("#prescWesternItemFormDiv").height(rigthDoctorCenterDivHeight-mainPerscriptionHeight-20);
        $("#prescWesternItemDiv").css("overflow","auto");
        $("#prescWesternItemFormDiv").css("overflow","auto");
    }

    function addTemplate(projectType,creator,deptCode,clinicId,patientId,visitId,inoroutFlag){
        addPrescItemTemplate(projectType,creator,deptCode,clinicId,patientId,visitId,inoroutFlag);
    }


</script>
<div class="col-lg-12" >
    <div class="col-lg-12 panel" id="mainPerscription">
            <div class="col-lg-3">
                <form:form id="inputForm" data-parsley-validate="" modelAttribute="prescriptionApply"  onsubmit="return newPresc('applyDiv','inputForm','${ctx}/doctor/prescriptionApply/save','${ctx}/doctor/prescriptionApply/applyIndex?visitId=${prescriptionApply.visitId}&patientId=${prescriptionApply.patientId}');" method="post" class="form-horizontal">
                    <div class="form-group">
                        <label class="col-sm-5 control-label">药房：</label>
                        <div class="col-sm-7">
                            <form:select path="implementDept" id="implementDept" class="form-control" data-parsley-required="true" onchange="deptChange('implementDept')">
                                <form:option value="" label="请选择药房"/>
                                <form:options items="${his_fns:getDrugStorageList('')}" itemLabel="storageName" itemValue="id"  htmlEscape="false"/>
                            </form:select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-5 control-label"></label>
                        <div class="col-sm-7">

                            <form:hidden  path="visitId" value="${prescriptionApply.visitId}" />
                            <input type="hidden" id="patientId" name="patientId">
                            <input type="hidden" id="inoroutFlag" name="inoroutFlag" value="1">
                            <input type="radio" name="itemClass" value="A" checked="checked" onclick="changeRadio('A')"/>西药 &nbsp;<input type="radio"   name="itemClass" value="B" onclick="changeRadio('B')"/>草药
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-5 control-label">处方属性：</label>
                        <div class="col-sm-7">
                            <form:select path="prescAttr" class="form-control" data-parsley-required="true">
                                <form:options items="${fns:getDictList('DRUG_PRESC_ATTR_DICT')}" itemLabel="label" itemValue="value"  htmlEscape="false"/>
                            </form:select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-5 control-label">生成医嘱：</label>
                        <div class="col-sm-7">
                            <form:select itemLabel="label" itemValue="value" path="ordersFlag"  class="form-control" data-parsley-required="true">
                                <form:option value="2" label="不生成"/>
                                <form:option value="0" label="生成临时"/>
                                <form:option value="1" label="生成长期"/>
                            </form:select>
                        </div>
                    </div>
                    <div class="demo-button">
                        <input id="btnSubmit" class="btn btn-success btn-rounded col-lg-12" type="submit" value="新 方">
                            <%--<button class="btn btn-success btn-rounded col-lg-12" type="submit">新方</button>--%>
                        <input id="btnSubmit" onclick="savePresc()" class="btn btn-primary btn-rounded col-lg-12" type="button" value="保 存">
                    </div>
                </form:form>
                <input id="addTemplate" onclick="addTemplate('2','${creator}','${billingDept}','${prescriptionApply.clinicId}','${prescriptionApply.patientId}','${prescriptionApply.visitId}','1')" class="btn btn-add btn-rounded col-lg-12" type="button" value="插入模板">
            </div>
        <div class="col-lg-9" >
            <section class="panel" id="applyDiv">
            </section>
        </div>
    </div>
</div>

    <div id="westPerscription" >
        <section class="col-lg-12 panel" id="prescWesternItemDiv">
            <jsp:include page="prescWesternItemIndex.jsp"></jsp:include>
        </section>
        <section class="col-lg-6 panel" id="prescWesternItemFormDiv" style="display: none">
        </section>
    </div>
    <div id="centrePerscription" style="display: none">
        <div class="col-lg-12">
            <section class="panel" id="prescChineseItemDiv">
            </section>
        </div>
    </div>
</div>


<script src="${ctxStatic}/js/doctor/prescriptionIndex.js"></script>
